import queue
# 基本的先入先出队列
q = queue.Queue(maxsize=5)  # maxsize:超过这个值,插入会阻塞,直到有数据被消费
for i in range(5):
    q.put(i)
while not q.empty():
    print(q.get())

# 后进先出队列
queue = queue.LifoQueue(maxsize=5)
for i in range(5):
    queue.put(i)
while not queue.empty():
    print(queue.get())

